<?php
    include('./config.php');
    include('./request.php');
    $arr = array();
    try{
        $pdo = new PDO($dsn,$user,$pass);
        $sql = "select * from market";
        $res = $pdo->prepare($sql);
        $res->execute();
        while($rea = $res->fetch(PDO::FETCH_ASSOC)){
            $temp = array('market_id'=>$rea['market_id'],'market_name'=>$rea['market_name'],'market_type'=>$rea['market_type'],'market_author'=>$rea['market_author'],'user_email'=>$rea['user_email'],'market_phone'=>$rea['market_phone']);
            array_unshift($arr,$temp);
        }
        echo json_encode($arr);
    }catch(PDOException $e){
        echo "error";
    }
?>